package com.greensam.pixelengine.pojo.emuns;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

/**
 * 角色枚举
 *
 * @author Macro_Ray
 * @since 2025/6/17 11:03
 */
@Getter
@AllArgsConstructor
public enum RoleEnum {

    ADMIN("管理员", "admin","系统管理员"),

    USER("普通用户", "user","系统普通用户"),

    ;

    private final String name;

    private final String code;

    private final String description;


    /**
     * 根据 code 获取枚举
     */
    public static RoleEnum getEnumByCode(String  code) {
        for (RoleEnum roleEnum : RoleEnum.values()) {
            if (roleEnum.code.equals(code)) {
                return roleEnum;
            }
        }
        return null;
    }

}
